<template>
	<el-dialog class="container" :showResPsd width="40%" :close-on-click-modal="false">
		<TitleBox :title="title"></TitleBox>
		<p class="content">确定要重置密码吗？重置后初始密码为a1234567</p>
		<div class="dialog-footer">
			<el-button @click="Resetcancle">取消</el-button>
			<el-button type="primary" @click="ResetOk">确定</el-button>
		</div>
	</el-dialog>
</template>

<script setup lang='ts'>
import { reqResetPassword } from '@/api/account';
import { ElMessage } from 'element-plus';
const props = defineProps(['resetId', 'showResPsd']);
const emit = defineEmits(['cancle', 'confirm']);
import TitleBox from '@/components/titleBox/index.vue';
import { ref } from 'vue';
const title =ref('重置密码');
// 确定重置密码
const ResetOk = async () => {
	const res = await reqResetPassword(props.resetId);
	if (res.data.code === 0) {
		emit('confirm', false);
		ElMessage({
			message: '重置成功',
			type: 'success',
		})
	} else {
		ElMessage({
			message: '重置失败',
			type: 'error',
		})
	}
}
// 取消
const Resetcancle = () => {
	emit('cancle', false);
}

</script>

<style scoped lang='scss'>
.container {

	// 文本内容
	.content {
		margin-top: 25px;
		margin-left: 20px;
	}

	.dialog-footer {
		margin-top: 20px;
		margin-left: 70%;
	}
}
</style>